using System;
using System.Linq;

namespace Rarous.NForms {
  /// <summary>
  /// Třída reprezentující zatrhávací políčko formuláře.
  /// </summary>
  public class CheckBoxItem : FormItem {
    /// <summary>
    /// Konstruktor.
    /// </summary>
    /// <param name="parent"></param>
    /// <param name="name"></param>
    /// <param name="label"></param>
    /// <param name="attributes"></param>
    public CheckBoxItem(Form parent, string name, string label, object attributes) {
      ConstructorContract(parent, name);

      Control = new HtmlElement(InputTag, new { Name = name, Id = ConvertNameToId(name), Type = InputType.CheckBox }, HtmlElement.SelfClosing);
      Label = CreateLabel(name, label);

      Register(parent, name);
      SetAttributes(attributes);
    }
  }
}
